<?php
namespace Home\Controller;
use Think\Controller;
use Home\Controller\BaseController;
class LoginController extends BaseController {
	public function login(){
		$this->display();

	}
	
	public function dologin(){
		$map=array(
			'ydq_username'=>I('post.ydq_username'),
		'ydq_pass'=>I('post.ydq_pass')
			);
		$users=M('users')->where($map)->find();
		//$this->model = D('users');

		if($users){
			session('users',$users);
			$this->success('登录成功！',U('Index/index'));

		}
		else{
			 $this->error('登录失败！'.$this->model->getError());
		}

	}
	
		public function logout(){
		session('[destroy]');
		$this->redirect('Index/index');
	}

	public function add(){

	 $data = I('post.');
       // dump($_FILES);
        $data['ydq_photo']=$this->uploadfile('ydq_photo');
     //  dump($data);exit;
        //
        //$data['whr_username']='';
        //$data['whr_username']=I['post.username'];伪装
        $this->model = D('users');
        //dump($this->model);exit;//D方法做验证
        if ($this->model->create($data)) {
            $this->model->add();
            $this->success('注册成功！',U('Index/index'));
        }else{
            $this->error('注册失败！'.$this->model->getError());
          //  parent::add($this->tbl,'ydq_logo');
	}


}}